﻿<%@ taglib prefix="page" uri="http://com.qipay/pagelib" %>
<%@ page language="java" import="com.qipay.admin.utils.SiteHelper" contentType="text/html;charset=utf-8" %>

<%@ page import="com.qipay.baas.model.SpRonghuiMch" %>
<%@ page import="com.qipay.baas.model.Constants" %>
<%@ page import="com.qipay.baas.model.MiBeiConstants" %>
<%@ page import="java.math.BigDecimal" %>
<%@ page import="com.qipay.baas.model.SpMbWidthdraw" %>
<!doctype html>
<html>
<head>
    <jsp:include page="head.jsp"></jsp:include>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <jsp:include page="nav.jsp"></jsp:include>
    <jsp:include page="left.jsp"></jsp:include>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Main content -->
        <% SpMbWidthdraw spMbWidthdraw = (SpMbWidthdraw) request.getAttribute("detail");
            boolean isAdd = String.valueOf(request.getAttribute("isadd")).equals("1");
            String balance = String.valueOf(request.getAttribute("balance"));
            BigDecimal bigDecimal = new BigDecimal(balance);
        %>
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box box-info">

                        <div class="box-header with-border">
                            <h3 class="box-title">编辑提现商户</h3>
                        </div>
                        <!-- /.box-header -->
                        <!-- form start -->
                        <form class="form-horizontal" action="save" method="POST" id="doc-vld-msg">
                            <input type="hidden" name="isApply">
                            <input type="hidden" name="id" value="<%= isAdd?"":String.valueOf(spMbWidthdraw.getId())%>">
                            <div class="box-body" id="dvContent">

                                <div class="form-group">
                                    <label for="txtbal" class="col-sm-2 control-label">余额：</label>
                                    <div class="col-sm-10">
                                        <input readonly="true " type="text" class="form-control" id="txtbal"
                                               value="<%=bigDecimal.divide(SiteHelper.decimalFor100)  %>"
                                               placeholder="余额">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="txtmchid" class="col-sm-2 control-label">商户号：</label>
                                    <div class="col-sm-10">
                                        <input readonly="true " type="text" class="form-control" id="txtmchid"
                                               name="mchId" mush="1"
                                               value="<%= MiBeiConstants.MCH_ID_VALUE %>" placeholder="商户号">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="txtoperator" class="col-sm-2 control-label">通道：</label>
                                    <div class="col-sm-10">
                                        <input readonly="true " type="text" class="form-control" id="txtoperator"
                                               name="operator" mush="1"
                                               value="<%= MiBeiConstants.OPERATOR_VALUE %>" placeholder="通道">
                                    </div>
                                </div>


                                <div class="form-group">
                                    <label for="txtbankcity" class="col-sm-2 control-label">收款银行所在城市：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtbankcity"
                                               name="bankCity" mush="1"
                                               value="<%= isAdd?"":spMbWidthdraw.getBankCity()%>"
                                               placeholder="收款银行所在城市">
                                    </div>
                                </div>

                                <%--  //只能为整数 单笔最大不超过 5 万元 单笔最小不低于 1 元--%>

                                <div class="form-group">
                                    <label for="txttotalfee" class="col-sm-2 control-label">代付金额/元：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txttotalfee" name="totalFee"
                                               mush="1"
                                               value="<%= isAdd?"":spMbWidthdraw.getTotalFee()/100 %>" placeholder="代付金额,只能为整数,单笔最小不低于 1 元">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="txtbody" class="col-sm-2 control-label">代付备注：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtbody"
                                               name="body"
                                               mush="1" value="<%= isAdd?"":spMbWidthdraw.getBody()%>"
                                               placeholder="代付备注">
                                    </div>
                                </div>
                                <%--  // 0：对私，1：对公--%>

                                <div class="form-group">
                                    <label for="ddlPaytype" class="col-sm-2 control-label">入账账户类型：</label>
                                    <div class="col-sm-10">
                                        <select id="ddlPaytype" name="payType">
                                            <option value="0"><%= SiteHelper.getMibeiPayType((byte) 0)%>
                                            </option>
                                            <option value="1"><%= SiteHelper.getMibeiPayType((byte) 1)%>
                                            </option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="txtpayname" class="col-sm-2 control-label">入账账户户名：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="txtpayname" name="payName"
                                           mush="1" value="<%= isAdd?"":spMbWidthdraw.getPayName()%>"
                                           placeholder="入账账户户名">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="txtPayCardNo" class="col-sm-2 control-label">入账账户账号：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="txtPayCardNo"
                                           name="PayCardNo"
                                           value="<%= isAdd?"":spMbWidthdraw.getPayCardNo()%>"
                                           placeholder="入账账户账号">
                                </div>
                            </div>
                            <%--//对公账户必须有联行号--%>
                            <div class="form-group">
                                <label for="txtbankunionno" class="col-sm-2 control-label">账户联行号：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="txtbankunionno"
                                           name="bankUnionNo"
                                            value="<%= isAdd?"":spMbWidthdraw.getBankUnionNo()%>"
                                           placeholder="账户联行号">
                                </div>
                            </div>

                            <!-- /.box-body -->
                            <div class="box-footer">
                                <button type="button" class="btn btn-default" onclick="window.history.back()">返回
                                </button>
                                <%if (spMbWidthdraw == null || (spMbWidthdraw != null && spMbWidthdraw.getState() != null && spMbWidthdraw.getState() != 0)) {%>

                                <button type="button"
                                        class="button back-green pull-right" id="btnSave">提现
                                </button>
                                <%}%>
                            </div>
                            <!-- /.box-footer -->

                        </form>
                    </div>
                    <!-- /.box -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <jsp:include page="foot.jsp"></jsp:include>
</div>
<script type="text/javascript"
<script src="<%= request.getAttribute("StaticHost") %>/js/fastclick.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/adminlte.min.js"></script>
<script>
    $(function () {
        /*申请时判断必填项*/
        $("#btnSave").on("click", function () {
            var isGo = checkInputMust("dvContent");
            var fee = $("#txttotalfee").val();
            var r = /^\+?[1-9][0-9]*$/;　　//正整数
           isGo=r.test(fee);
            if(fee<1||isGo==false){
                alert("代付金额为大于1元的整数")
            }

            var payType = $("#ddlPaytype").val();
            var  bankunionno = $("#txtbankunionno").val();
            if (payType==1&&(bankunionno==null||bankunionno=="")){
                isGo =false;
                alert("对公账户。银联号不为空");
            }
            if (isGo) {
                $("#doc-vld-msg")[0].submit();
            }
        })
    })


</script>
</body>
</html>

